package top.jinlijun.heytea.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.jinlijun.heytea.entities.Address;
import top.jinlijun.heytea.entities.User;
import top.jinlijun.heytea.mapper.LoginMapper;
import top.jinlijun.heytea.service.ILoginService;

import java.util.List;

@Service
@Transactional
public class LoginServiceImpl implements ILoginService {

    @Autowired
    private LoginMapper loginMapper;

    @Override
    public User findUserByTel(User user) {
        User userByTel = loginMapper.findUserByTel(user);
        return userByTel;
    }

    @Override
    public User findUserByEmail(User user) {
        User userByEmail = loginMapper.findUserByEmail(user);
        return userByEmail;
    }

    @Override
    public User findUserById(User user) {
        User userById = loginMapper.findUserById(user);
        return userById;
    }

    @Override
    public void InsertUser(User user) {
        loginMapper.InsertUser(user);
    }

    @Override
    public List<Address> getAddressList(User user) {
        return loginMapper.getAddressList(user);
    }

    @Override
    public void insertAddress(Address address) {
        loginMapper.insertAddress(address);
    }

    @Override
    public void cancelDefault(User user) {
        loginMapper.cancelDefault(user);
    }

    @Override
    public void setDefault(Address address) {
        loginMapper.setDefault(address);
    }

    @Override
    public void updateUser(User user) {
        loginMapper.updateUser(user);
    }
}
